PROP_SORT_INDICATOR,
PROP_SORT_ORDER,
PROP_SORT_COLUMN_ID,
- PROP_CELL_AREA
+ PROP_CELL_AREA,
+ LAST_PROP
};
enum
};
static guint tree_column_signals[LAST_SIGNAL] = { 0 };
+static GParamSpec *tree_column_props[LAST_PROP] = { NULL, };
G_DEFINE_TYPE_WITH_CODE (GtkTreeViewColumn, gtk_tree_view_column, G_TYPE_INITIALLY_UNOWNED,
G_ADD_PRIVATE (GtkTreeViewColumn)
_gtk_marshal_VOID__VOID,
G_TYPE_NONE, 0);
- g_object_class_install_property (object_class,
- PROP_VISIBLE,
- g_param_spec_boolean ("visible",
- P_("Visible"),
- P_("Whether to display the column"),
- TRUE,
- GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY));
-
- g_object_class_install_property (object_class,
- PROP_RESIZABLE,
- g_param_spec_boolean ("resizable",
- P_("Resizable"),
- P_("Column is user-resizable"),
- FALSE,
- GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY));
-
- g_object_class_install_property (object_class,
- PROP_X_OFFSET,
- g_param_spec_int ("x-offset",
- P_("X position"),
- P_("Current X position of the column"),
- -G_MAXINT,
- G_MAXINT,
- 0,
- GTK_PARAM_READABLE));
-
- g_object_class_install_property (object_class,
- PROP_WIDTH,
- g_param_spec_int ("width",
- P_("Width"),
- P_("Current width of the column"),
- 0,
- G_MAXINT,
- 0,
- GTK_PARAM_READABLE));
- g_object_class_install_property (object_class,
- PROP_SPACING,
- g_param_spec_int ("spacing",
- P_("Spacing"),
- P_("Space which is inserted between cells"),
- 0,
- G_MAXINT,
- 0,
- GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY));
- g_object_class_install_property (object_class,
- PROP_SIZING,
- g_param_spec_enum ("sizing",
- P_("Sizing"),
- P_("Resize mode of the column"),
- GTK_TYPE_TREE_VIEW_COLUMN_SIZING,
- GTK_TREE_VIEW_COLUMN_GROW_ONLY,
- GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY));
-
- g_object_class_install_property (object_class,
- PROP_FIXED_WIDTH,
- g_param_spec_int ("fixed-width",
- P_("Fixed Width"),
- P_("Current fixed width of the column"),
- -1, G_MAXINT, -1,
- GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY));
-
- g_object_class_install_property (object_class,
- PROP_MIN_WIDTH,
- g_param_spec_int ("min-width",
- P_("Minimum Width"),
- P_("Minimum allowed width of the column"),
- -1, G_MAXINT, -1,
- GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY));
-
- g_object_class_install_property (object_class,
- PROP_MAX_WIDTH,
- g_param_spec_int ("max-width",
- P_("Maximum Width"),
- P_("Maximum allowed width of the column"),
- -1, G_MAXINT, -1,
- GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY));
-
- g_object_class_install_property (object_class,
- PROP_TITLE,
- g_param_spec_string ("title",
- P_("Title"),
- P_("Title to appear in column header"),
- "",
- GTK_PARAM_READWRITE));
-
- g_object_class_install_property (object_class,
- PROP_EXPAND,
- g_param_spec_boolean ("expand",
- P_("Expand"),
- P_("Column gets share of extra width allocated to the widget"),
- FALSE,
- GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY));
-
- g_object_class_install_property (object_class,
- PROP_CLICKABLE,
- g_param_spec_boolean ("clickable",
- P_("Clickable"),
- P_("Whether the header can be clicked"),
- FALSE,
- GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY));
-
-
- g_object_class_install_property (object_class,
- PROP_WIDGET,
- g_param_spec_object ("widget",
- P_("Widget"),
- P_("Widget to put in column header button instead of column title"),
- GTK_TYPE_WIDGET,
- GTK_PARAM_READWRITE));
-
- g_object_class_install_property (object_class,
- PROP_ALIGNMENT,
- g_param_spec_float ("alignment",
- P_("Alignment"),
- P_("X Alignment of the column header text or widget"),
- 0.0, 1.0, 0.0,
- GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY));
-
- g_object_class_install_property (object_class,
- PROP_REORDERABLE,
- g_param_spec_boolean ("reorderable",
- P_("Reorderable"),
- P_("Whether the column can be reordered around the headers"),
- FALSE,
- GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY));
-
- g_object_class_install_property (object_class,
- PROP_SORT_INDICATOR,
- g_param_spec_boolean ("sort-indicator",
- P_("Sort indicator"),
- P_("Whether to show a sort indicator"),
- FALSE,
- GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY));
-
- g_object_class_install_property (object_class,
- PROP_SORT_ORDER,
- g_param_spec_enum ("sort-order",
- P_("Sort order"),
- P_("Sort direction the sort indicator should indicate"),
- GTK_TYPE_SORT_TYPE,
- GTK_SORT_ASCENDING,
- GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY));
+ tree_column_props[PROP_VISIBLE] =
+ g_param_spec_boolean ("visible",
+ P_("Visible"),
+ P_("Whether to display the column"),
+ TRUE,
+ GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY);
+
+ tree_column_props[PROP_RESIZABLE] =
+ g_param_spec_boolean ("resizable",
+ P_("Resizable"),
+ P_("Column is user-resizable"),
+ FALSE,
+ GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY);
+
+ tree_column_props[PROP_X_OFFSET] =
+ g_param_spec_int ("x-offset",
+ P_("X position"),
+ P_("Current X position of the column"),
+ -G_MAXINT, G_MAXINT,
+ 0,
+ GTK_PARAM_READABLE);
+
+ tree_column_props[PROP_WIDTH] =
+ g_param_spec_int ("width",
+ P_("Width"),
+ P_("Current width of the column"),
+ 0, G_MAXINT,
+ 0,
+ GTK_PARAM_READABLE);
+
+ tree_column_props[PROP_SPACING] =
+ g_param_spec_int ("spacing",
+ P_("Spacing"),
+ P_("Space which is inserted between cells"),
+ 0, G_MAXINT,
+ 0,
+ GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY);
+
+ tree_column_props[PROP_SIZING] =
+ g_param_spec_enum ("sizing",
+ P_("Sizing"),
+ P_("Resize mode of the column"),
+ GTK_TYPE_TREE_VIEW_COLUMN_SIZING,
+ GTK_TREE_VIEW_COLUMN_GROW_ONLY,
+ GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY);
+
+ tree_column_props[PROP_FIXED_WIDTH] =
+ g_param_spec_int ("fixed-width",
+ P_("Fixed Width"),
+ P_("Current fixed width of the column"),
+ -1, G_MAXINT,
+ -1,
+ GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY);
+
+ tree_column_props[PROP_MIN_WIDTH] =
+ g_param_spec_int ("min-width",
+ P_("Minimum Width"),
+ P_("Minimum allowed width of the column"),
+ -1, G_MAXINT,
+ -1,
+ GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY);
+
+ tree_column_props[PROP_MAX_WIDTH] =
+ g_param_spec_int ("max-width",
+ P_("Maximum Width"),
+ P_("Maximum allowed width of the column"),
+ -1, G_MAXINT,
+ -1,
+ GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY);
+
+ tree_column_props[PROP_TITLE] =
+ g_param_spec_string ("title",
+ P_("Title"),
+ P_("Title to appear in column header"),
+ "",
+ GTK_PARAM_READWRITE);
+
+ tree_column_props[PROP_EXPAND] =
+ g_param_spec_boolean ("expand",
+ P_("Expand"),
+ P_("Column gets share of extra width allocated to the widget"),
+ FALSE,
+ GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY);
+
+ tree_column_props[PROP_CLICKABLE] =
+ g_param_spec_boolean ("clickable",
+ P_("Clickable"),
+ P_("Whether the header can be clicked"),
+ FALSE,
+ GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY);
+
+ tree_column_props[PROP_WIDGET] =
+ g_param_spec_object ("widget",
+ P_("Widget"),
+ P_("Widget to put in column header button instead of column title"),
+ GTK_TYPE_WIDGET,
+ GTK_PARAM_READWRITE);
+
+ tree_column_props[PROP_ALIGNMENT] =
+ g_param_spec_float ("alignment",
+ P_("Alignment"),
+ P_("X Alignment of the column header text or widget"),
+ 0.0, 1.0, 0.0,
+ GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY);
+
+ tree_column_props[PROP_REORDERABLE] =
+ g_param_spec_boolean ("reorderable",
+ P_("Reorderable"),
+ P_("Whether the column can be reordered around the headers"),
+ FALSE,
+ GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY);
+
+ tree_column_props[PROP_SORT_INDICATOR] =
+ g_param_spec_boolean ("sort-indicator",
+ P_("Sort indicator"),
+ P_("Whether to show a sort indicator"),
+ FALSE,
+ GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY);
+
+ tree_column_props[PROP_SORT_ORDER] =
+ g_param_spec_enum ("sort-order",
+ P_("Sort order"),
+ P_("Sort direction the sort indicator should indicate"),
+ GTK_TYPE_SORT_TYPE,
+ GTK_SORT_ASCENDING,
+ GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY);
/**
* GtkTreeViewColumn:sort-column-id:
*
* Since: 2.18
**/
- g_object_class_install_property (object_class,
- PROP_SORT_COLUMN_ID,
- g_param_spec_int ("sort-column-id",
- P_("Sort column ID"),
- P_("Logical sort column ID this column sorts on when selected for sorting"),
- -1, G_MAXINT, -1,
- GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY));
+ tree_column_props[PROP_SORT_COLUMN_ID] =
+ g_param_spec_int ("sort-column-id",
+ P_("Sort column ID"),
+ P_("Logical sort column ID this column sorts on when selected for sorting"),
+ -1, G_MAXINT,
+ -1,
+ GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY);
/**
* GtkTreeViewColumn:cell-area:
*
* Since: 3.0
*/
- g_object_class_install_property (object_class,
- PROP_CELL_AREA,
- g_param_spec_object ("cell-area",
- P_("Cell Area"),
- P_("The GtkCellArea used to layout cells"),
- GTK_TYPE_CELL_AREA,
- GTK_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
+ tree_column_props[PROP_CELL_AREA] =
+ g_param_spec_object ("cell-area",
+ P_("Cell Area"),
+ P_("The GtkCellArea used to layout cells"),
+ GTK_TYPE_CELL_AREA,
+ GTK_PARAM_READWRITE|G_PARAM_CONSTRUCT_ONLY);
+
+ g_object_class_install_properties (object_class, LAST_PROP, tree_column_props);
}
static void
gtk_cell_area_box_set_spacing (GTK_CELL_AREA_BOX (priv->cell_area), spacing);
if (priv->tree_view)
_gtk_tree_view_column_cell_set_dirty (tree_column, TRUE);
- g_object_notify (G_OBJECT (tree_column), "spacing");
+ g_object_notify_by_pspec (G_OBJECT (tree_column), tree_column_props[PROP_SPACING]);
}
}
}
gtk_tree_view_column_update_button (tree_column);
- g_object_notify (G_OBJECT (tree_column), "visible");
+ g_object_notify_by_pspec (G_OBJECT (tree_column), tree_column_props[PROP_VISIBLE]);
}
/**
gtk_tree_view_column_update_button (tree_column);
- g_object_notify (G_OBJECT (tree_column), "resizable");
+ g_object_notify_by_pspec (G_OBJECT (tree_column), tree_column_props[PROP_RESIZABLE]);
}
/**
gtk_tree_view_column_update_button (tree_column);
- g_object_notify (G_OBJECT (tree_column), "sizing");
+ g_object_notify_by_pspec (G_OBJECT (tree_column), tree_column_props[PROP_SIZING]);
}
/**
TREE_VIEW_DRAG_WIDTH, allocation.height);
}
- g_object_notify (G_OBJECT (tree_column), "x-offset");
- g_object_notify (G_OBJECT (tree_column), "width");
+ g_object_notify_by_pspec (G_OBJECT (tree_column), tree_column_props[PROP_X_OFFSET]);
+ g_object_notify_by_pspec (G_OBJECT (tree_column), tree_column_props[PROP_WIDTH]);
}
/**
gtk_widget_get_realized (priv->tree_view))
gtk_widget_queue_resize (priv->tree_view);
- g_object_notify (G_OBJECT (tree_column), "fixed-width");
+ g_object_notify_by_pspec (G_OBJECT (tree_column), tree_column_props[PROP_FIXED_WIDTH]);
}
}
if (priv->max_width != -1 && priv->max_width < min_width)
{
priv->max_width = min_width;
- g_object_notify (G_OBJECT (tree_column), "max-width");
+ g_object_notify_by_pspec (G_OBJECT (tree_column), tree_column_props[PROP_MAX_WIDTH]);
}
- g_object_notify (G_OBJECT (tree_column), "min-width");
+ g_object_notify_by_pspec (G_OBJECT (tree_column), tree_column_props[PROP_MIN_WIDTH]);
g_object_thaw_notify (G_OBJECT (tree_column));
if (priv->column_type == GTK_TREE_VIEW_COLUMN_AUTOSIZE && priv->tree_view)
if (max_width != -1 && max_width < priv->min_width)
{
priv->min_width = max_width;
- g_object_notify (G_OBJECT (tree_column), "min-width");
+ g_object_notify_by_pspec (G_OBJECT (tree_column), tree_column_props[PROP_MIN_WIDTH]);
}
- g_object_notify (G_OBJECT (tree_column), "max-width");
+ g_object_notify_by_pspec (G_OBJECT (tree_column), tree_column_props[PROP_MAX_WIDTH]);
g_object_thaw_notify (G_OBJECT (tree_column));
if (priv->column_type == GTK_TREE_VIEW_COLUMN_AUTOSIZE && priv->tree_view)
priv->title = new_title;
gtk_tree_view_column_update_button (tree_column);
- g_object_notify (G_OBJECT (tree_column), "title");
+ g_object_notify_by_pspec (G_OBJECT (tree_column), tree_column_props[PROP_TITLE]);
}
/**
gtk_widget_queue_resize (priv->tree_view);
}
- g_object_notify (G_OBJECT (tree_column), "expand");
+ g_object_notify_by_pspec (G_OBJECT (tree_column), tree_column_props[PROP_EXPAND]);
}
/**
priv->clickable = clickable;
gtk_tree_view_column_update_button (tree_column);
- g_object_notify (G_OBJECT (tree_column), "clickable");
+ g_object_notify_by_pspec (G_OBJECT (tree_column), tree_column_props[PROP_CLICKABLE]);
}
/**
if (widget)
g_object_ref_sink (widget);
- if (priv->child)
+ if (priv->child)
g_object_unref (priv->child);
priv->child = widget;
gtk_tree_view_column_update_button (tree_column);
- g_object_notify (G_OBJECT (tree_column), "widget");
+ g_object_notify_by_pspec (G_OBJECT (tree_column), tree_column_props[PROP_WIDGET]);
}
/**
priv->xalign = xalign;
gtk_tree_view_column_update_button (tree_column);
- g_object_notify (G_OBJECT (tree_column), "alignment");
+ g_object_notify_by_pspec (G_OBJECT (tree_column), tree_column_props[PROP_ALIGNMENT]);
}
/**
priv->reorderable = (reorderable?TRUE:FALSE);
gtk_tree_view_column_update_button (tree_column);
- g_object_notify (G_OBJECT (tree_column), "reorderable");
+ g_object_notify_by_pspec (G_OBJECT (tree_column), tree_column_props[PROP_REORDERABLE]);
}
/**
gtk_tree_view_column_set_sort_order (tree_column, GTK_SORT_ASCENDING);
gtk_tree_view_column_set_sort_indicator (tree_column, FALSE);
gtk_tree_view_column_set_clickable (tree_column, FALSE);
- g_object_notify (G_OBJECT (tree_column), "sort-column-id");
+ g_object_notify_by_pspec (G_OBJECT (tree_column), tree_column_props[PROP_SORT_COLUMN_ID]);
return;
}
NULL);
gtk_tree_view_column_setup_sort_column_id_callback (tree_column);
- g_object_notify (G_OBJECT (tree_column), "sort-column-id");
+ g_object_notify_by_pspec (G_OBJECT (tree_column), tree_column_props[PROP_SORT_COLUMN_ID]);
}
/**
tree_column->priv->show_sort_indicator = setting;
gtk_tree_view_column_update_button (tree_column);
- g_object_notify (G_OBJECT (tree_column), "sort-indicator");
+ g_object_notify_by_pspec (G_OBJECT (tree_column), tree_column_props[PROP_SORT_INDICATOR]);
}
/**
tree_column->priv->sort_order = order;
gtk_tree_view_column_update_button (tree_column);
- g_object_notify (G_OBJECT (tree_column), "sort-order");
+ g_object_notify_by_pspec (G_OBJECT (tree_column), tree_column_props[PROP_SORT_ORDER]);
}
/**